package Thread;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

public class ThreadDemo2 {
    public static void main(String[] args) {
        Callable<String> call=new MyCallable();
        FutureTask<String> f1=new FutureTask<>(call);
        Thread t=new Thread(f1);
        t.start();

        try {
            String s = f1.get();
            System.out.println(s);
        } catch (Exception e) {
            e.printStackTrace();

    }
    }
}
